package com.baymax.test.scene.internal

/**
 * @title:       标题
 * @project:     TestScene
 * @package:     com.baymax.test.scene.internal
 * @class:       StyleListState
 * @description:
 * <p>
 * 类描述
 * </p>
 *
 * @version:   1.0
 * @createDate:   2023/2/1 19:20
 * @Copyright (C) 2023 YSTEN
 * @author:       xuyujian
 */
data class StyleListState(val styles: List<Style>) {
    init {
        require(styles.isNotEmpty())
    }

    val maxWidthStyle = styles.maxBy { it.width }

    private val maxPartition =
        styles.minus(maxWidthStyle).partition { (it.left + it.width) <= this.maxWidthStyle.left + this.maxWidthStyle.width }

    val maxLeft = maxPartition.first.toSet()
    val maxRight = maxPartition.second.toSet()
}